{% extends 'base.html' %}

{% block con %}
<h4>数据列表</h4>
<div class="container">
    <div class="row">
        <div class="col-md-9">
            {% if showListView.config.search_fields %}
                <form action="" class="pull-right">
                    <input type="text" name="search" value="{{ showListView.config.keyword }}"><button class="btn-info">Submit</button>
                </form>
            {% endif %}

            <a href="{{ add_url }}" class="btn btn-info">添加数据</a>
        <form action="" method="post">
        {% csrf_token %}
            <select name="action" id="" style="width: 200px;display: inline-block; vertical-align: -1px">
                {% for foo in showListView.get_action_list %}
                    <option value="{{ foo.name }}">{{ foo.desc }}</option>
                {% endfor %}
            </select>
            <button type="submit" class="btn btn-info">Submit</button>
            <table class="table table-bordered table-striped">
                <thead>
                    <tr>
                        {% for foo in showListView.get_header %}
                        <th>{{ foo }}</th>
                        {% endfor %}

                    </tr>

                </thead>
                <tbody>
                     {% for data in showListView.get_body %}

                      <tr>
                          {% for item in data %}
                           <td>{{ item }}</td>
                          {% endfor %}

                      </tr>
                     {% endfor %}

                </tbody>
            </table>

            <ul class="pagination">
                {{ showListView.pagination.page_html|safe }}
            </ul>
        </form>
        </div>

        <div class="col-md-3">
            <div class="filter">
            {% for filter_field, linktags in showListView.get_filter_linktags.items %}
                <div class="well">
                <p>{{ filter_field }}</p>
                {% for linktag in linktags %}
                    <p>{{ linktag|safe }}</p>
                {% endfor %}
                </div>
            {% endfor %}
            </div>
        </div>
    </div>
</div>
<script>
    $("#choice").click(function () {
        if($(this).prop("checked")){
            $(".choice_item").prop("checked", true);
        }else {
            $(".choice_item").prop("checked", false);
        }
    })
</script>
{% endblock %}